Add --with-ebpf-includes parameter
authorHilko Bengen <bengen@debian.org>
Tue, 23 Jul 2019 12:43:21 +0000 (14:43 +0200)
committerAndreas Dolp <dev@andreas-dolp.de>
Tue, 13 Jan 2026 18:51:26 +0000 (19:51 +0100)
Gbp-Pq: Name with-ebpf-includes.patch

configure.ac
ebpf/Makefile.am

index 794866ab0c76105ebcf7747746e4aed6f5f94535..c33451b185871824f9eda293223d488313b60cb2 100644 (file)
                     AC_SUBST(LLC)
                   ],
                   [AC_MSG_ERROR([clang needed to build ebpf files])])
-            AC_MSG_CHECKING([libbpf has bpf/bpf_helpers.h])
+            AC_ARG_WITH(ebpf_includes,
+                    [  --with-ebpf-includes=DIR  include directory for building eBPF programs],
+                    [AC_SUBST([ebpf_includes],["$withval"])],
+                    [AC_SUBST([ebpf_includes],["/usr/include/${build_alias}"])])
+           AC_MSG_CHECKING([libbpf has bpf/bpf_helpers.h])
             AC_COMPILE_IFELSE(
                 [AC_LANG_PROGRAM(
                     [
index d43c2c97a2c21b46330ec2c3d75293a4cecdf75e..898c5bd7a684d86cb4ba2085a6dd9f3695011f72 100644 (file)
@@ -4,7 +4,7 @@ EXTRA_DIST= include bypass_filter.c filter.c lb.c vlan_filter.c xdp_filter.c \
 if BUILD_EBPF
 
 # Maintaining a local copy of UAPI linux/bpf.h
-BPF_CFLAGS = -Iinclude
+BPF_CFLAGS = -Iinclude -I$(ebpf_includes)
 
 BPF_TARGETS  = lb.bpf
 BPF_TARGETS += filter.bpf
@@ -19,7 +19,6 @@ all: $(BPF_TARGETS)
 $(BPF_TARGETS): %.bpf: %.c
 #      From C-code to LLVM-IR format suffix .ll (clang -S -emit-llvm)
        ${CLANG} -Wall $(BPF_CFLAGS) -O2 -g \
-               -I/usr/include/$(build_cpu)-$(build_os)/ \
                -D__KERNEL__ -D__ASM_SYSREG_H \
                -target bpf -S -emit-llvm $< -o ${@:.bpf=.ll}
 #      From LLVM-IR to BPF-bytecode in ELF-obj file